//
//  PetServiceCell.m
//  TaTaBang
//
//  Created by 李禹 on 15/8/16.
//  Copyright (c) 2015年 hailong. All rights reserved.
//

#import "TTPetServiceCell.h"

@interface TTPetServiceCell ()
@property (weak, nonatomic) IBOutlet UIImageView *photoImageView;
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;
@property (weak, nonatomic) IBOutlet UIImageView *nameImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *masterTipLabel;
@property (weak, nonatomic) IBOutlet UILabel *masterLabel;
@property (weak, nonatomic) IBOutlet UILabel *noTipLabel;
@property (weak, nonatomic) IBOutlet UILabel *noLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeTipLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *ageTipLabel;
@property (weak, nonatomic) IBOutlet UILabel *ageLabel;
@property (weak, nonatomic) IBOutlet UILabel *hairColorTipLabel;
@property (weak, nonatomic) IBOutlet UILabel *hairColorLabel;
@property (weak, nonatomic) IBOutlet UILabel *weightTipLabel;
@property (weak, nonatomic) IBOutlet UILabel *weightLabel;
@property (weak, nonatomic) IBOutlet UIButton *moreButton;
@property (weak, nonatomic) IBOutlet UIButton *editButton;

@end

@implementation TTPetServiceCell

+ (instancetype)petServiceCellWithTableView:(UITableView *)tableView {
    static NSString *identifier = @"TTPetServiceCell";
    TTPetServiceCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"TTPetServiceCell" owner:nil options:nil] lastObject];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (void)awakeFromNib {
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setEditStatus:(BOOL)editStatus {
    _editStatus = editStatus;
    
    self.editButton.hidden = !editStatus;
}

- (void)setPet:(Pet *)pet {
    _pet = pet;
    
    self.editButton.selected = pet.selected;
}

- (IBAction)editButtonDidClick:(UIButton *)sender {
    sender.selected = !sender.selected;
    
    self.pet.selected = sender.selected;
    if ([self.delegate respondsToSelector:@selector(petServiceCell:didSelectedEditButton:)]) {
        [self.delegate petServiceCell:self didSelectedEditButton:self.pet];
    }

}


- (IBAction)moreButtonDidClick:(UIButton *)sender {
}

@end
